package com.hznu.stmanage.serviceImpl;

import com.hznu.stmanage.dao.SummaryMapper;
import com.hznu.stmanage.entity.Summary;
import com.hznu.stmanage.service.BaseService;
import com.hznu.stmanage.service.SummaryService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by J_Vino on 16/3/6.
 */
@Transactional(rollbackFor = Exception.class)
@Service
public class SummaryServiceImpl extends BaseService implements SummaryService {

    SummaryMapper summaryMapper = null;
    public void setMapper()
    {
        if(summaryMapper==null)
            summaryMapper = getSummmaryMapper();//1.获取相关mapper
    }
    public int deleteByPrimaryKey(Long id) {
        setMapper();
        return summaryMapper.deleteByPrimaryKey(id);
    }

    public int insert(Summary record) {
        setMapper();
        return summaryMapper.insert(record);
    }

    public int insertSelective(Summary record) {
        setMapper();
        return summaryMapper.insertSelective(record);
    }

    public Summary selectByPrimaryKey(Long id) {
        setMapper();
        return summaryMapper.selectByPrimaryKey(id);
    }

    public int updateByPrimaryKeySelective(Summary record) {
        setMapper();
        return summaryMapper.updateByPrimaryKeySelective(record);
    }

    public int updateByPrimaryKey(Summary record) {
        setMapper();
        return summaryMapper.updateByPrimaryKey(record);
    }
}
